package com.wx.business.course.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.eachonline.mapper.GenericMapper;
import com.eachonline.service.GenericServiceImpl;
import com.wx.business.course.IxbBusinessPictureService;
import com.wx.business.util.YesOrNo;
import com.wx.dao.mapper.IxbBusinessPictureMapper;
import com.wx.model.IxbBusinessPicture;
import com.wx.model.IxbBusinessPictureExample;
@Service("ixbBusinessPictureService")
public class IxbBusinessPictureServiceImpl extends GenericServiceImpl<IxbBusinessPicture, IxbBusinessPictureExample, String> implements IxbBusinessPictureService  {

	private static final  Logger logger =Logger.getLogger(IxbBusinessPictureService.class);

	@Resource
	private IxbBusinessPictureMapper ixbBusinessPictureMapper;
	
	@Override
	protected GenericMapper<IxbBusinessPicture, IxbBusinessPictureExample, String> getGenericMapper() {
		return ixbBusinessPictureMapper;
	}

	@Override
	public IxbBusinessPicture queryCourseMainPicture(String courseId) {
		// TODO Auto-generated method stub
		IxbBusinessPictureExample ext=new IxbBusinessPictureExample();
		ext.createCriteria().andBusinessIdEqualTo(courseId).andIsMainEqualTo(YesOrNo.YES+"");
		List<IxbBusinessPicture> businessPiclist=selectByExample(ext);
		
		return businessPiclist.get(0);
	}

	
}
